package cn.tedu.lbs.basic.web.service;

import cn.tedu.lbs.basic.web.repository.BusinessCategoryRepository;
import com.tarena.lbs.pojo.basic.po.BusinessCategoryPO;
import com.tarena.lbs.pojo.basic.vo.BusinessCategoryVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service
@Slf4j
public class kong {
    @Autowired
    private BusinessCategoryRepository businessCategoryRepository;
    public List<BusinessCategoryVO> list() {
        List<BusinessCategoryPO> pos =businessCategoryRepository.list();
        List<BusinessCategoryVO> vos = null;
        if (pos != null && pos.size()>0){
            vos = pos.stream().map(po->{
                BusinessCategoryVO vo = new BusinessCategoryVO();
                BeanUtils.copyProperties(po,vo);
                return vo;
            }).collect(Collectors.toList());
        }
        return vos;
    }
}
